package com.project.erp.model.system;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import com.google.common.collect.Lists;
import com.project.erp.model.IdEntity;

/**
 * 
 * COPYRIGHT (C) 2013 BY XXX公司
 * 
 * 功能模块名：系统参数主表
 * 
 * 功能描述：设置系统参数名称，包换中英文
 * 
 * @author LiJiaGuo
 * 
 * @version 1.0
 * 
 * @created 2013-11-10 下午3:16:05
 */
@Entity
@Table(name = "TBL_PARAM")
// 默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Param extends IdEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 825863357495457976L;

	private String nameEn;// 参数英文名称
	private String nameZn;// 参数中文名称
	private String description;// 参数描述
	
	private List<ParamValue> paramList = Lists.newArrayList(); //有序的关联对象集合

	public Param() {
	}

	public Param(String nameEn, String nameZn, String description) {
		super();
		this.nameEn = nameEn;
		this.nameZn = nameZn;
		this.description = description;
	}

	public String getNameEn() {
		return nameEn;
	}

	public void setNameEn(String nameEn) {
		this.nameEn = nameEn;
	}

	public String getNameZn() {
		return nameZn;
	}

	public void setNameZn(String nameZn) {
		this.nameZn = nameZn;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	//mappedBy="expenses"说明此字段由实体ExpensesDetail的字段expenses映射而来，防止生成关联表
	@OneToMany(mappedBy="param")
	@Cascade(value = {CascadeType.SAVE_UPDATE,CascadeType.DELETE,CascadeType.ALL})
	public List<ParamValue> getParamList() {
		return paramList;
	}

	public void setParamList(List<ParamValue> paramList) {
		this.paramList = paramList;
	}
}
